package com.sh.设计模式.工厂模式相关.工厂方法模式;

import com.sh.设计模式.工厂模式相关.工厂方法模式.工厂方法impl.AudiFactory;
import com.sh.设计模式.工厂模式相关.工厂方法模式.工厂方法impl.BMWFactory;

// 测试
public class FactoryMethodTest {
    public static void main(String[] args) {
        CarFactory factory1 = new BMWFactory();
        Car car1 = factory1.createCar();
        car1.drive();  // Driving BMW

        CarFactory factory2 = new AudiFactory();
        Car car2 = factory2.createCar();
        car2.drive();  // Driving Audi
    }
}